package everyday;

import org.junit.jupiter.api.Test;
import tool.s;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;

public class T0970 {
    public List<Integer> powerfulIntegers(int x, int y, int bound) {
        Set<Integer> set = new HashSet<>();
        int a = 1, b = 1;
        while (a + 1 <= bound) {
            b=1;
            while (a + b <= bound){
                set.add(a + b);
                b*=y;
                if (y==1)break;
            }
            a*=x;
            if (x==1)break;
        }
        return new ArrayList<>(set);
    }

    @Test
    public void test() {
        powerfulIntegers(2, 3, 10);
    }
}
